﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AspNetCs.Bll;
using AspNetCs.Model;
using AspNetCs.Common;
using AspNetCs.Config;
public partial class Master_Admin_login : Admin_BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Admin AdminLogin = new Admin();
        string SessionCode = "";
        if (Session["VerifyCode"] != null)
        {
            SessionCode = Session["VerifyCode"].ToString().Trim().ToLower();

        }
        else
        {
            Response.Write("<script>alert('验证码有误,返回后请刷新页面重新再试');history.back();</script>");
            Response.End();

        }


        string PutCode = CheckCode.Text.Trim().ToLower();
        if (SessionCode != PutCode)
        {
            Response.Write("<script>alert('请输入正确的验证码');history.back();</script>");
            Response.End();
        }

        Admin_Model model = new Admin_Model();
        model.UserName = StringHelper.HtmlEncrypt(UserName.Text.Trim());
        model.Pwd = StringHelper.HtmlEncrypt(Password.Text.Trim()); ;
        if (AdminLogin.AdminLogin(model) == 0)
        {
            Response.Redirect("default.Aspx");
            Response.End();

        }
        else
        {
            Response.Write("<script>alert('请不要非法尝试登录后台!!');history.back();</script>");
            Response.End();
        }


    }
}
